﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Diagnostics;
using System.Configuration;
using NDesk.Options; // We are using a great command-line options parsing library by http://www.NDesk.org/options

namespace Macaw.SolutionsFactory.FactoryIdeTools.CCNetBuildStation
{
    public static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            FormBuildStation fb = new FormBuildStation();
            Application.Run(fb);

            // Cleanup the CCNet and Cassini applications
            if (fb.WebServerProcess != null)
            {
                try
                {
                    fb.WebServerProcess.Kill();
                }
                catch (Exception)
                {
                }
            }

            if (fb.CCNetProcess != null)
            {
                try
                {
                    fb.CCNetProcess.Kill();
                }
                catch (Exception)
                {
                }
            }
        }
    }
}
